package view;

import java.awt.Image;
import java.io.IOException;

import javax.swing.Icon;
import javax.swing.ImageIcon;

public final class FwkViewsUtils {

	private FwkViewsUtils() {
	}

	public static Icon getIcon(String path, int width, int hints) {
		Icon icon = null;
		if (path != null && !path.isEmpty()) {
			Image image = new ImageIcon(path).getImage();
			image = image.getScaledInstance(width, hints, Image.SCALE_SMOOTH);
			icon = new ImageIcon(image);
		}
		return icon;
	}
	
	public static Icon getIcon(String path) throws IOException {
		Icon icon = null;
		if (path != null && !path.isEmpty()) {
			Image image = new ImageIcon(path).getImage();
			icon = new ImageIcon(image);
		}
		return icon;
	}
}